package com.push.web.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hankcs.hanlp.HanLP;
import com.push.common.annotation.Log;
import com.push.common.core.controller.BaseController;
import com.push.common.core.domain.AjaxResult;
import com.push.common.core.page.TableDataInfo;
import com.push.common.enums.BusinessType;
import com.push.common.utils.MD5;
import com.push.common.utils.StringUtils;
import com.push.common.utils.httpclient.HttpClientUtil;
import com.push.common.utils.poi.ExcelUtil;
import com.push.web.domain.BizArticle;
import com.push.web.domain.BizCollection;
import com.push.web.service.IBizOCRService;
import com.push.web.utils.WordUtil;
import com.push.web.vo.ExpressBodyVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;

import static com.push.common.utils.StringUtils.delHtmlTags;

/**
 * 识别和分析图片中的文字Controller
 *
 * @author daoguang
 * @date 2024-04-12
 */
@RestController
@RequestMapping("/ocr/pic")
public class BizOCRController extends BaseController
{
    @Autowired
    private IBizOCRService bizOCRService;

    /**
     * 解析传入过来的URL
     *
     * @param URL字符串
     * @return 解析之后的列表
     */
    @GetMapping("/parseURL")
    public AjaxResult parseURL(@RequestParam String URL)
    {
        List<String> result = bizOCRService.parseURL(URL);
        return AjaxResult.success(result);
    }
}
